﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class admin_thongkelichdien : System.Web.UI.Page
{
    private int total;
    public int Total
    {
        get { return total; }
        set { total = value; }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DropDownList1.DataSource = ChuongTrinh.GetTenCT();
            DropDownList1.DataTextField = "tenct";
            DropDownList1.DataValueField = "mact";
            DropDownList1.Items.Add(new ListItem("--Please select--", "-1"));
            DropDownList1.AppendDataBoundItems = true;
            DropDownList1.DataBind();
            DropDownList1.SelectedIndex = -1;
        }
        else
        {
            load();
        }
    }

    private void load()
    {
        string mact = DropDownList1.SelectedItem.Value;
        var ldien = LichDien.XemLichDien_PhanTom(Convert.ToInt32(mact), ref total);
        ASPxGridView1.DataSource = ldien;
        ASPxGridView1.DataBind();
        Label1.Text = total.ToString();
    }
    
}